package ygw.study.designPatterns.decorator;

import org.junit.jupiter.api.Test;

/**
 * <p>
 * 装饰器模式
 * </p>
 * <p>
 * Copyright:2021.All rights reserved.
 * </p>
 * <p>
 * Company:Zsoft
 * </p>
 * <p>
 * CreateDate:2021-05-21 12:52
 * </p>
 *
 * @author YuGongWen
 * @history Mender:YuGongWen；Date:2021-05-21 12:52；
 */
public class TestDecoratorPattern {

    @Test
    public void test() {
        Shape circle = new Circle();
        ShapeDecorator redCircle = new RedShapeDecorator(new Circle());
        ShapeDecorator redRectangle = new RedShapeDecorator(new Rectangle());
        //Shape redCircle = new RedShapeDecorator(new Circle());
        //Shape redRectangle = new RedShapeDecorator(new Rectangle());
        System.out.println("Circle with normal border");
        circle.draw();

        System.out.println("\nCircle of red border");
        redCircle.draw();

        System.out.println("\nRectangle of red border");
        redRectangle.draw();
    }
}